/**
 * @file rank/popularize/luogu1678/main.cpp
 * @brief
 * @see
 * @author Ruiming Guo (guoruiming@stu.scu.edu.cn)
 * @copyright 2022
 * @date 2022/7/8 23:00:37
 **/

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
int m, n;
const int N = 100010;
int a[N], b[N];
int main() {
  // High rating and good luck!
  cin >> m >> n;
  for (int i = 0; i < m; ++i) cin >> a[i];
  for (int i = 0; i < n; ++i) cin >> b[i];
  int l = 0, r = m - 1;
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    while (l < r) {
      int mid = (l + r) / 2;
      if (a[mid] <= b[i])
        l = mid + 1;
      else
        r = mid;
    }
    if (b[i] <= a[0]) {
      ans += a[0];
    } else {
      ans += min(abs(a[l - 1] - b[i]), abs(a[l] - b[i]));
    }
  }
  cout << ans << endl;
  return 0;
}
